---这个工具类用来解析properties 字符串 或者文件
local StringUtil = require ("util/StringUtil")
local _M ={}
function _M.parseProperties(propertisStr)
    ngx.log(ngx.INFO ,"parseProperties str: "..propertisStr);
    local ary = StringUtil.split(propertisStr,"\n");
    local resultMap = {}
    ngx.log(ngx.INFO ,"换行符分割结果 "..#ary);
    for i=1,#ary do
        if  ary[i] ~= nil then  ---如果为空跳过下一个

            ngx.log(ngx.INFO ,"准备解析键值对 : "..ary[i].. "类型"..type(ary[i]));
            if  type(ary[i]) == "string" then
                 ary[i]=StringUtil.trim(ary[i])
                if not ary[i].startswith("#") then
                    local keyVal = StringUtil.split( ary[i],"=")
                    ngx.log(ngx.INFO ,"键值对才分后的数组长度为 : "..#keyVal);
                    if keyVal ~=nil and #keyVal==2 then
                        resultMap[StringUtil.trim(keyVal[1])]= StringUtil.trim(keyVal[2])
                        ngx.log(ngx.INFO ,"找到properties "..keyVal[1].." value "..keyVal[2]);
                    end
                end

            end
        end


    end

    return resultMap;


end
function _M.readFile(path)
    local fileContent =FileUtil.readFile(path);
    return self.parseProperties(fileContent);



end
return _M;